<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserBuilderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_builder', function (Blueprint $table) {
            $table->comment = '用户评测表';
            $table->increments('id');
            $table->timestamps();
            $table->softDeletes();

            $table->integer('bmr_user_id')->comment('用户表bmr_users.id');
            $table->decimal('cycle', 3)->default(0.00)->comment('运动周期指数');
            $table->decimal('weight')->default(0.00)->comment('体重');
            $table->decimal('addWeight')->default(0.00)->comment('增重、减重(负数)/kg');
            $table->decimal('height')->default(0.00)->comment('身高/cm');
            $table->decimal('age')->default(0.00)->comment('年龄');
            $table->decimal('totalHot')->default(0)->comment('总热量');
            $table->decimal('baseHot')->default(0)->comment('基础热量');

            $table->index('bmr_user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_builder');
    }
}
